#ifndef TESTUB_H
#define TESTUB_H

#include "../arbol-ub/arbolub.h"
#include "../arbol-ub/registroub.h"
#include "../arbol-ub/iteradorub.cpp"
#include <stdio.h>

void testUB2D() {

//    remove("arbolUB.bin");

    ArbolUB<2, 16> arbol("arbolUB.bin", 128);

    if ( arbol.isOpen()) {

        for (int x = 0; x <= 100; x++){
            for (int y = 100; y >= 0; y--){
                Point<2> point = {x, y};
                RegistroUB<2, 16> reg(point);

                arbol.insertar(reg);
            }
        }
        //std::cout << arbol.toString() << std::endl;

        Point<2> min = {19, 0};
        Point<2> max = {20, ~0};

        IteradorUB<2, 16> iterador(arbol, min, max);

        auto func = [](Point<2> point){ std::cout << point[0] << ',' << point[1] << std::endl; };
        iterador.start(func);
    }
}

#endif // TESTUB_H
